import cv2 
import numpy as np


def main():
	image_path = "../images/Lenna.png"
	img = cv2.imread(image_path, 0)

	#print(img.shape)
	# img_2 = img.copy()
	img_2 = cv2.resize(img, (640, 480))	
	cv2.imshow("lenna", img)
	print(img_2.shape)
	cv2.imshow("lenna_2", img_2)

	color_black = [0,0,0]
	color_white = [255,255,255]

	i = 0
	while i < 640:
		j = 0
		while j < 480:
			img_3 = cv2.fillPoly(img_2, [np.array([(i, j),(i+80,j),(i+80,j+80),(i,j+80)])],color_black)
			img_3 = cv2.fillPoly(img_2, [np.array([(i+80, j),(i+160,j),(i+160,j+80),(i+80,j+80)])],color_white)
			j += 160
			print(i, j)
		i += 160

	i = 0
	while i < 640:
		j = 80
		while j < 480:
			img_3 = cv2.fillPoly(img_2, [np.array([(i, j),(i+80,j),(i+80,j+80),(i,j+80)])],color_white)
			img_3 = cv2.fillPoly(img_2, [np.array([(i+80, j),(i+160,j),(i+160,j+80),(i+80,j+80)])],color_black)
			print(i, j)
			j += 160
		i += 160

	

	cv2.imshow("lenna_3", img_3)
	cv2.waitKey(0)
	cv2.destroyAllWindows()



if __name__ == '__main__':
	main()